<template>
	<view class="uni-goods-nav">
		<!-- 底部占位 -->
		<view class="uni-tab__seat" />
		<view class="uni-tab__cart-box flex-row">
			<view class="flex-row uni-tab__cart-sub-box">
				<view v-for="(item,index) in options" :key="index" class="flex-row uni-tab__cart-button-left"
					@click="onClick(index,item)">
					<view class="uni-tab__icon">
						<image class="image" :src="item.icon" mode="widthFix" />
					</view>
					<text class="uni-tab__text">{{ item.text }}</text>
					<!-- #ifdef MP-WEIXIN -->
					<button open-type="share" class="btn" v-if="index==1"></button>
					<!-- #endif -->
				</view>
			</view>
			<view class="flex-row items-center justify-between fill" style="padding: 20upx;">
				<view class="uni-nav-one" v-for="(v,k) in buttonGroup" :key="k" :class="'btn-'+ k"
					@click="buttonClick(k,v)">
					{{v.text}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'UniGoodsNav',
		data() {
			return {
				options: [{
						icon: '/static/img/kf.png',
						text: '客服'
					},
					{
						icon: '/static/img/fx.png',
						text: '分享'
					},
					{
						icon: '/static/img/ts.png',
						text: '故障'
					}
				],
				buttonGroup: [{
						text: '充值'
					}, {
						text: '扫码'
					},
					{
						text: '导航'
					}
				]

			}
		},
		props: {
			fill: {
				type: Boolean,
				default: false
			}
		},
		methods: {
			onClick(index, item) {
				console.log(this.collect)
				this.$emit('click', {
					index,
					content: item
				})
			},
			buttonClick(index, item) {
				if (uni.report) {
					uni.report(item.text, item.text)
				}
				this.$emit('buttonClick', {
					index,
					content: item
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	.uni-flex {
		flex: 1;
	}

	.btn-0 {
		background: #DFEAFF;
		border: 1rpx solid #2461D0;
		color: #2461D0 !important;
	}
	.btn-1 {
		background: #FFFCEC;
		border: 1rpx solid #F9D703;
		color: #574B00 !important;
	}

	.btn-2 {
		background: $uni-color-bg;
	}

	.uni-nav-three {
		background: #C0C0C0;
		width: 420upx;
		height: 68upx;
		line-height: 68upx;
		text-align: center;
		border-radius: 38upx;
		color: #FFFFFF;
	}

	.flex {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
	}

	.uni-goods-nav {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex: 1;
		flex-direction: row;
		position: fixed;
		bottom: 0;
		width: 100%;
		left: 50%;
		transform: translateX(-50%);
		box-shadow: 0 0 20upx 0 rgba(0, 0, 0, 0.5);
		z-index: 99999;
	}

	.uni-tab__cart-box {
		flex: 1;
		height: 100rpx;
		background-color: #fff;
		z-index: 900;
	}

	.uni-tab__cart-sub-box {
		width: 40%;
	}

	.uni-tab__right {
		overflow: hidden;
	}

	.uni-tab__cart-button-left {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex: 1;
		position: relative;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		position: relative;
	}

	.btn {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
	}

	.uni-tab__icon {
		width: 36upx;
		height: 36upx;
	}

	.image {
		width: 36upx;
		height: 36upx;
	}

	.uni-tab__text {
		margin-top: 3px;
		font-size: $uni-font-size-sm;
		color: #666;
	}

	.uni-tab__cart-button-right {
		/* #ifndef APP-NVUE */
		display: flex;
		flex-direction: column;
		/* #endif */
		flex: 1;
		justify-content: center;
		align-items: center;
	}

	.uni-tab__cart-button-right-text {
		font-size: $uni-font-size-base;
		color: #fff;
		width: 221upx;
		line-height: 100upx;
		border-radius: 38upx;
	}

	.uni-tab__cart-button-right:active {
		opacity: 0.7;
	}

	.uni-tab__dot-box {
		/* #ifndef APP-NVUE */
		display: flex;
		flex-direction: column;
		/* #endif */
		position: absolute;
		right: 12px;
		top: 4px;
		justify-content: center;
		align-items: center;
	}

	.uni-tab__dot {
		padding: 0 4px;
		line-height: 15px;
		color: #ffffff;
		text-align: center;
		font-size: 12px;
		background-color: #ff0000;
		border-radius: 15px;
	}

	.uni-tab__dots {
		padding: 0 4px;
		border-radius: 15px;
	}

	.uni-nav-one {
		width: 130rpx;
		line-height: 68upx;
		text-align: center;
		border-radius: 38upx;
		color: #FFFFFF;
	}
</style>